import Vue from 'vue'
import vuex from 'vuex'
import VuexPersistence from 'vuex-persist';

const vuexLocal = new VuexPersistence({
  storage: window.localStorage
});

Vue.use(vuex);

import dialog from './modules/dialog';//引入某个store对象
import alert from './modules/alert';//弹窗状态
import searchHistort from './modules/search-history';//历史搜索
import house from './modules/house';//二手房
import newHouse from './modules/newHouse';//新房
import indexStore from './modules/indexStore';//首页模块
import entrustHouse from './modules/entrustHouse';//委托房源
import video from './modules/video';//视频
import search from './modules/search';//搜索
export default new vuex.Store({
  modules: {
    dialog: dialog,
    alert:alert,
    // other: other,//其他组件
    searchHistort:searchHistort,
    house:house,
    newHouse:newHouse,
    indexStore:indexStore,
    entrustHouse:entrustHouse,
    video:video,
    search:search,
  },
  state:{
    routerName:''
  },
  getters:{
    getRouterName(state){
      return state.routerName
    }
  },
  mutations: {
    setRouterName(state,name){
        state.routerName = name
    }
  },
  actions:{
    // RouterName(context, data){
    //   context.commit('setRouterName', data);
    //   window.localStorage.setItem('routerName', JSON.stringify(data));
    // }
  },
  plugins: [vuexLocal.plugin]
})
